﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EMC.VISITOR.Application
{
    [SugarTable(null, "企业微信消息发送状态")]
    [BusinessVS]
    public class WchatMessage : EntityBase
    {
        [SugarColumn(ColumnDescription = "消息类型", IsNullable = true, IndexGroupNameList = new string[] { "index_wmsg_mtype" })]
        public MessageType? MessageType { get; set; }
        [SugarColumn(ColumnDescription = "程序是否发送成功", IsNullable = true, IndexGroupNameList = new string[] { "index_issend" })]
        public bool? IsSend { get; set; } = false;
        [SugarColumn(ColumnDescription = "邮件接收人Id", IsNullable = true, IndexGroupNameList = new string[] { "index_wmsg_leadid" })]
        public long? LeaderId { get; set; }
        [SugarColumn(ColumnDescription = "被访人姓名", IsNullable = true)]
        public string LeaderName { get; set; }
        [SugarColumn(ColumnDescription = "被访人工号", IsNullable = true)]
        public string LeaderCode { get; set; }
        [SugarColumn(ColumnDescription = "被访人手机", IsNullable = true)]
        public string LeaderPhone { get; set; }
        [SugarColumn(ColumnDescription = "访客Id", IsNullable = true, IndexGroupNameList = new string[] { "index_wmsg_vid" })]
        public long? VisitorId { get; set; }

        [SugarColumn(ColumnDescription = "企业微信/邮箱返回结果", IsNullable = true)]
        public bool? WchatSendResult { get; set; }
        [SugarColumn(ColumnDescription = "企业微信/邮箱发送失败结果", IsNullable = true)]
        public string? WchatResultMessage { get; set; }
        [SugarColumn(ColumnDescription = "是否每天发送一次", IsNullable = true)]
        public bool? OneDaySend { get; set; } = false;
        /// <summary>
        /// 一般访客需要被访人确认，然后再发送企业微信和邮件发给主管，如果没有被访人则直接发送给主管
        /// </summary>
        [SugarColumn(ColumnDescription = "被访人是否已确认", IsNullable = true)]
        public bool? IsConfirm { get; set; } = true;

        [SugarColumn(ColumnDescription = "这条消息是否发给主管", IsNullable = true)]
        public bool? IsManager { get; set; } = false;
        [SugarColumn(ColumnDescription = "邮件服务器随机数", IsNullable = true)]
        public int? RandomCount { get; set; }
        [Navigate(NavigateType.OneToOne, nameof(LeaderId))]
        public virtual SysUser User { get; set; }
        [Navigate(NavigateType.OneToOne, nameof(VisitorId))]
        public virtual VisitLog Visitor { get; set; }
    }
}
